package com.example.app.components.MyField

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.example.app.components.MyText.MyText
import com.example.app.ui.theme.my_description_color

@Composable
fun MyField(
    label: String = "",
    value: String = "",
    labelContent: @Composable () -> Unit = {},
    valueContent: @Composable () -> Unit = {},
) {
    Row(
        modifier = Modifier.fillMaxWidth(),
        horizontalArrangement = Arrangement.SpaceBetween,
        verticalAlignment = Alignment.CenterVertically
    ) {
        if (label.isEmpty()) {
            labelContent()
        } else {
            MyText(text = label)
        }

        if (value.isEmpty()) {
            valueContent()
        } else {
            MyText(
                text = value,
                color = my_description_color,
                style = MaterialTheme.typography.bodySmall
            )
        }
    }
}